package com.tanhua.model.vo;

import com.tanhua.model.domain.UserInfo;
import com.tanhua.model.mongo.Sound;
import com.tanhua.model.mongo.Video;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ReceiveSoundVo implements Serializable {


    private Long userId;
    private String avatar; //头像
    private String nickname; //昵称
    private String gender; //性别
    private String soundUrl;
    private Integer age;
    private Integer remainingTimes; //剩余次数

    public static ReceiveSoundVo init(UserInfo userInfo, Sound item) {
        ReceiveSoundVo vo = new ReceiveSoundVo();
        //copy用户属性
        BeanUtils.copyProperties(userInfo,vo);  //source,target
        vo.setSoundUrl(item.getSoundUrl());
        return vo;
    }
}